
//=============================================================================================
// Implementation of Exposure Fusion
//
// This work is described in
//   "Exposure Fusion"
//   Tom Mertens, Jan Kautz and Frank Van Reeth
//   In Proceedings of Pacific Graphics 2007
//
// written by Kuen-Shiou Tsai, July 2013
// e-mail: kuenbutsai@gmail.com
//=============================================================================================

#ifndef EXPO_FUSION
#define EXPO_FUSION

#include "utils.h"
#include <time.h>

class expo_fusion
{
public:
	expo_fusion();
	int process(Mat &src);
	void build_gamma_table();

	Mat recon;

private:
	void gamma_correc(Mat &src, vector<Mat>&dst);
	int getWeightMap(Mat &src, Mat &gc, Mat &weight);
	void normalize_weight(vector<Mat> &m);
	void build_laplacian_pyramid(Mat &src, vector<Mat> &pyramid_laplacian);
	void reconstruction(vector<Mat> &pyramid_laplacian, Mat &recon);

	Mat gamma_table;
	vector<int> gamma_i;


	//int cl_init();
	//char* cl_ReadSources(const char *fileName);
	//int cl_initBuffer(Mat &src, Mat &dst);
	//int cl_release();
	//int cl_execute_kernel(Mat &src, Mat &dst, float gamma);

	//cl_device_id		device;
	//cl_platform_id		platform;
	//cl_context        	ctx;
	//cl_command_queue  	cmdq;
	//cl_program		  	program;
	//cl_kernel		  	kernel;
	//cl_event			evt;
	//cl_mem				input_buf, output_buf;
};

#endif